import { User } from '../../../db/models/user'
import {sendSuccess,sendError } from "../../utils/responseHandler";

export default async function handler(req, res) {
    if (req.method === 'POST') {
        try {
            const {userId} = req.body;
            const hrInfo = await User.findOne({
                where:{
                    id:userId
                }
            });
            sendSuccess(res, hrInfo);
        } catch (error) {
            console.error('获取失败:', error);
            sendError(res, '获取失败', 500);
        }
    } else {
        res.setHeader('Allow', ['GET', 'POST']);
        res.status(405).end(`Method ${req.method} Not Allowed`);
    }
}
